SOClose


C Specification

#include <dolphin/socket.h>
int SOClose ( int s );

Description

SOClose() closes the socket descriptor.

The following table summarizes the SOClose() behavior for the SO_SOCK_STREAM (TCP) socket when the SO_O_NONBLOCK flag is not set with SOFcntl():

SOLinger Description
onoff = 0 (default) SOClose() returns as quickly as possible and all data is transmitted in the background.
onoff = 1
linger = 0
SOClose() returns immediately and the current connection is aborted.
onoff = 1
linger != 0
SOClose() blocks until all data is transmitted for up to the specified linger time.

If the SO_O_NONBLOCK flag is set, SOClose() aborts the TCP connection immediately.

Arguments

s The socket descriptor to be closed.

Return Values

zero Succeeded.
SO_EBADF Bad socket descriptor.
SO_ENETRESET Socket library is not initialized.

Note: Additional errors may be generated and returned in future library releases. All the negative return values must be treated as generic errors.

See Also

SOFcntl, SOLinger, SOGetSockOpt(), SOSetSockOpt(), SOShutdown()